import { User } from "../type/entity";
import { http } from "../util/http";

export function login(account:string, password:string){
  return http.post<User>('/login', {account, password})
}

export function register(account:string, password:string, userName:string){
  return http.post<User>('/register', {account, password, userName})
}

export function getUserByToken(token:string){
  return http.post<User>('/getUserByToken', {token})
}

export function getCaptcha(){
  return http.post<{id:string, base64String:string}>('/getCaptcha')
}

export function verifyCaptcha(id:string, answer:string){
  return http.post<{success:boolean}>('/verifyCaptcha', {id, answer})
}